import { IMenubarList } from '/@/type/store/layout';

const components = {
    Layout: () => import('/@/layout'),
    Redirect: () => import('/@/layout/redirect.vue'),
    LayoutBlank: () => import('/@/layout/blank.vue'),
    404: () => import('/@/layout/error-page/404.vue'),
    Login: () => import('/@/layout/user/login.vue')
};

// 静态路由页面
export const allowRouter: Array<IMenubarList> = [
    {
        name: 'Home',
        path: '/',
        component: components['Layout'],
        redirect: `/redirect/${import.meta.env.VITE_MENU_HOME}`,
        meta: { title: 'HOME', icon: '', hidden: true }
    },
    {
        name: 'error-page',
        path: '/error-page',
        meta: { title: '错误页面', hidden: true, icon: 'el-icon-eleme' },
        component: components.LayoutBlank,
        redirect: '/error-page/404',
        children: [
            {
                name: '404',
                path: '/error-page/404',
                component: components['404'],
                meta: { title: '404', icon: 'el-icon-s-tools' }
            }
        ]
    },
    {
        name: 'redirect',
        path: '/redirect/:pathMatch(.*)*',
        meta: {
            title: '重定向页面',
            icon: '',
            hidden: true,
            permission: []
        },
        component: components.Redirect
    },
    {
        name: 'login',
        path: '/login',
        component: components.Login,
        meta: { title: '登录', icon: 'el-icon-eleme', hidden: true }
    }
];

export default allowRouter;
